

//获取用户余额和石油
exports.getUserMachineCount = function (uid, level) {
    return new Promise((resolve, reject) => {
        let mysqlClient = this.app.get('mysqlClient');

        let sql = "SELECT count(*) as count from machine WHERE uid = ? and machine_level = ?";
        mysqlClient.query(sql, [uid, level], function (err, res) {
            if (err) {
                return reject(err);
            }
            let objRes = JSON.parse(JSON.stringify(res));
            resolve(objRes[0].count);
        });
    });
}